fix(grep): bound filesystem scans - #483
Conversation
|
ScriptedAlchemy
left a comment
There was a problem hiding this comment.
Security review found no malicious indicators or auth/network/secret/workflow/dependency tampering. The generated-directory whitelist regression was fixed with TDD at the current head; scoped re-review passed with no remaining Critical or Important findings.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bac90abe71
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let may_match_descendants = wildcard_suffix | ||
| .iter() | ||
| .enumerate() | ||
| .any(|(index, segment)| index > 0 || *segment == "**"); |
There was a problem hiding this comment.
Handle slashless globs as matching descendants
When path_glob is a basename pattern such as *.js, wildcard_suffix contains only one non-** segment, so may_match_descendants becomes false. Under the handler's documented .gitignore-style glob semantics, that pattern matches basenames at any depth; however, for dist/app.js, filter_entry rejects the generated dist directory before the override can match the file, causing an explicit filtered search to return a false negative. Treat slashless positive patterns as potentially matching descendants.
Useful? React with 👍 / 👎.
Summary
tracedecay_grepfilesystem traversal and reads off the async runtimeRoot cause
tracedecay_grepperformed a synchronousWalkBuildertraversal andstd::fs::readdirectly inside its async MCP handler. On repositories whoseignore files did not cover generated dependency trees, the walker could enter
large directories such as virtual environments. When a client timed out or
disconnected, the daemon-side scan continued, and concurrent requests could
repeat the same work. The CLI fallback used the same daemon and scanner, so it
could stall behind the original request.
Behavior
cancellation during traversal, before file reads, and while matching lines
path_glob.gitand.tracedecayare always excluded, including linked-worktree.gitfilesstd::fs::readThis is intentionally separate from #481. It does not change worktree identity
resolution, daemon lifecycle, project routing, or store migration.
Validation
.venvmatch reproducedcargo fmt --all -- --check: passedgit diff --check: passed2b48fb4b94e3bed156c307275ce428351e45f6c8: PASS, no findingsThe target worktree was not registered in the local TraceDecay project index,
so semantic impact lookup was unavailable without initializing another store.
Validation stayed bounded to the exact diff and focused compiled regressions.